package SellCar.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import SellCar.pojo.News;
import SellCar.service.impl.NewsBizImpl;

@Controller
public class NewsController {
	@Autowired
	@Qualifier("newsBizImpl")
	private NewsBizImpl newsBizImpl;
	ModelAndView mav = new ModelAndView();
	@RequestMapping("news")
	public ModelAndView toNews(HttpServletRequest request){
		HttpSession session = request.getSession();
		String uname = (String) session.getAttribute("userName");
		List<News> newslist = newsBizImpl.getNewslist();
		mav.addObject("newslist", newslist);
		mav.setViewName("guide");
		return mav;
	}
	

}
